UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w+BYFgW+ZU2qSoK6II00E4JCrfzrRkEF1Duwt8xm/to='
WHERE
key_id = 'a8b052c48f454558ab07ebfe24b1138228c9c723c4200428703a84bd58fbc2a9'
AND (
token = 'w+BYFgW+ZU2qSoK6II00E4JCrfzrRkEF1Duwt8xm/to='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)