UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KE4obZqi17RgsgPtNUbk9wCqiGHAzpAGB8p9rqzduA0='
WHERE
key_id = '55e1126cb4b5f8e8ae045642e505ed58a8b2822384edd642b2af26fe08636e06'
AND (
token = 'KE4obZqi17RgsgPtNUbk9wCqiGHAzpAGB8p9rqzduA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)