UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cPKYrQui2jP7yE+SEB3vkHOVyZam3aHX3ph1d9jAQeA='
WHERE
key_id = '652e341e491c6f439d4b582b5fe7c07be59924d9b2505ce52e9361a2f79f721b'
AND (
token = 'cPKYrQui2jP7yE+SEB3vkHOVyZam3aHX3ph1d9jAQeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)