UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1b8s/zwkHe5f3HUWKJl10HDsqGtzol/tfUVPtjkxyko=' 
WHERE 
  key_id = 'ff4db768254602cb24d27e617dd7016eb104bff913fdd532c71717f77860ace2' 
  AND (
    token = '1b8s/zwkHe5f3HUWKJl10HDsqGtzol/tfUVPtjkxyko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032