UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S9s9kFARZSU/URkC9D6LTOp5/N97xJPgQv4EfH4zmf0=' 
WHERE 
  key_id = '5f4ee3a8f9e4317ae37f9f8a01c0feaee9c34232c6ce9b2b3d3ec40a9d7b4305' 
  AND (
    token = 'S9s9kFARZSU/URkC9D6LTOp5/N97xJPgQv4EfH4zmf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032