UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xGqb+kz93ObitVL3DJBqfJKqUmTjYvDphqh+7DX+rpk=' 
WHERE 
  key_id = 'a5e3f3052839358b067227ffc17c23cd9a1e3a8095f2b2a92f63d22e17242f1b' 
  AND (
    token = 'xGqb+kz93ObitVL3DJBqfJKqUmTjYvDphqh+7DX+rpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028