UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8q+PDpPaEnqideo57SKVFfmdwKBbhITMI4PXp5+f2ss='
WHERE
key_id = 'af359fe19934552a92a558a39af77fe40f9c0dd35e8c015cae0f708e86e88b16'
AND (
token = '8q+PDpPaEnqideo57SKVFfmdwKBbhITMI4PXp5+f2ss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)