UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oGlcJ0wmTV/eOrrCaQma2zXGhzgVVF+fTWUX76r6HxU=' 
WHERE 
  key_id = '6942bc35169f1e993fc9d43e35753c394050b326ecda4920a8c8e89a46a6a564' 
  AND (
    token = 'oGlcJ0wmTV/eOrrCaQma2zXGhzgVVF+fTWUX76r6HxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037