UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PSyLdCGSsE749hA3o3DT2AkxezmiGLugNQXDi38WA9I=' 
WHERE 
  key_id = '42463c8d12720dd1146d9dcdd8f21f054ffd221a4a8e24cf66b0a921de04b953' 
  AND (
    token = 'PSyLdCGSsE749hA3o3DT2AkxezmiGLugNQXDi38WA9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026