UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aYjw2j0ctRP2yf4/+rh2gD/9hH9kerwiytT8TjEG6Zo='
WHERE
key_id = 'ea158de6e965140633df8c9c6c5ba95504eefa80d0359b965b3e1741a46408ff'
AND (
token = 'aYjw2j0ctRP2yf4/+rh2gD/9hH9kerwiytT8TjEG6Zo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)