UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MmT62tNED/NP8ksLWDLm/LLlekwbomGxodViuUjA7AU=' 
WHERE 
  key_id = '164ede7d509936d4f82719d94339325e49da76bd01cb13aae9a34be97581d3e5' 
  AND (
    token = 'MmT62tNED/NP8ksLWDLm/LLlekwbomGxodViuUjA7AU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033