UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oSYXXvIYdCkRKeNS2GtZY6cjEjkfffwbIy9/a7K9RGQ=' 
WHERE 
  key_id = '67eb4404c1b97e180d9b4df32b5be94899eaad9e8a3977d96e3ca61c7140f28b' 
  AND (
    token = 'oSYXXvIYdCkRKeNS2GtZY6cjEjkfffwbIy9/a7K9RGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035