UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c9DLk7C+Q0gst7Y70CUzr5ZRa5ubd3iI/MrDxrMmio0=' 
WHERE 
  key_id = 'b7421e0b87fcccb7adf5f9888001152aae5a6fd880e30a1768a5e3ba32673178' 
  AND (
    token = 'c9DLk7C+Q0gst7Y70CUzr5ZRa5ubd3iI/MrDxrMmio0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029