UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AjF6M/BYtMjikABgAglM/XtLuelUM+y6N9heygaTzZ0=' 
WHERE 
  key_id = '3c74f7586bb901b301eb3c36d6e833bafc0574b97e576ac9d608c62fe6a36d32' 
  AND (
    token = 'AjF6M/BYtMjikABgAglM/XtLuelUM+y6N9heygaTzZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040