UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lgu6iU1TEHqOwNvW9JGXbuWADc3EvgpuTfD697ZUPP0=' 
WHERE 
  key_id = 'c97d8c1892cd6cc4a094f93c54be6ea39f87a7a820d2504888648f5ca80165f1' 
  AND (
    token = 'Lgu6iU1TEHqOwNvW9JGXbuWADc3EvgpuTfD697ZUPP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025