UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NTQJSfNisl65jlCm4DMEuoOa2OtqWxsOBjUzX9BibOM=' 
WHERE 
  key_id = '289b5de0dc9a77a5a93533deb7c1b9f4095253e3608ce9d80a76c07953c814fd' 
  AND (
    token = 'NTQJSfNisl65jlCm4DMEuoOa2OtqWxsOBjUzX9BibOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042