UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jcNI5FfiI6hjgRVKASGSlgfyLS25RuIsa367fjGjxOU=' 
WHERE 
  key_id = 'ffb10cd00eb60e2eca44b13134304f02b788065f77a02ff20ffc4f658f90fcb9' 
  AND (
    token = 'jcNI5FfiI6hjgRVKASGSlgfyLS25RuIsa367fjGjxOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016