UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'erZpDVmCoSoWDHax7AhA9ZWn+YMJFSJBzGSuNip63FE=' 
WHERE 
  key_id = '169e3eeb5ac279d7e476b9f009adb13ebc58fb91e5b891049a5dba7374bc49d4' 
  AND (
    token = 'erZpDVmCoSoWDHax7AhA9ZWn+YMJFSJBzGSuNip63FE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045