UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fG3dlwiMEPmeg1skv4oV+4gs+IjMUDp6seSqxeHTVAY=' 
WHERE 
  key_id = '822e98e20e67948adf2ae3cbae908b7a214e3a41e3d5efa10d11dcce567874db' 
  AND (
    token = 'fG3dlwiMEPmeg1skv4oV+4gs+IjMUDp6seSqxeHTVAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037