UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cG32L1t/GKLOAKlS1RquqR+C8FddIK7h3Ls+CBCZdq0=' 
WHERE 
  key_id = '3310f3426ddbc0a22d6011163a74ce15a13327bbee3a2a07824066a9d63dc4c5' 
  AND (
    token = 'cG32L1t/GKLOAKlS1RquqR+C8FddIK7h3Ls+CBCZdq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047