UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DAZtxny7hzlKI6f9HvJaJimpv+GfypACSOkkzbU1frk=' 
WHERE 
  key_id = '2cb8ac5d12200324bf3d433efffc2e310e96936da7a445bbd24608c408bb0448' 
  AND (
    token = 'DAZtxny7hzlKI6f9HvJaJimpv+GfypACSOkkzbU1frk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026