UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c86fznTEkekmKr438KnAOU/aHDWTF1RKiFzt2KfaaOk=' 
WHERE 
  key_id = 'eb6b42774b034266915abe3a06f20f8f037f17df139df1caa30e81b379539e75' 
  AND (
    token = 'c86fznTEkekmKr438KnAOU/aHDWTF1RKiFzt2KfaaOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022