UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cRfjAKMfgwY4SoHmFav9k2mWRGT6nATcgs0pCxpQ++o='
WHERE
key_id = 'bb335537b4f7bc777a36e73d27073aead2243c7bb8d5954c20ce524dc6b6be53'
AND (
token = 'cRfjAKMfgwY4SoHmFav9k2mWRGT6nATcgs0pCxpQ++o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)