UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PFf9nt1xnbWwOy8Jm3Wvx1+mtgyHvM8JQLYWwitWBgo='
WHERE
key_id = 'ce0e4df50be54de8ca1eeaad7ca89e1387f960339903d375938d2773b693ad21'
AND (
token = 'PFf9nt1xnbWwOy8Jm3Wvx1+mtgyHvM8JQLYWwitWBgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)