UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'owK8KbiWPlupX6sdv+PRjZaWM2A3RqIiyaId1ry3g6k=' 
WHERE 
  key_id = '8be244885b8885704262d0e14a24416e6c14a07367103409a86506db06d788fa' 
  AND (
    token = 'owK8KbiWPlupX6sdv+PRjZaWM2A3RqIiyaId1ry3g6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023