UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RuqXPsJvLcP1HlYOFk2Mx8XTh5dcPCjUg5Gkv6ruX2U='
WHERE
key_id = '46247c62a252cdbaa018fd8a3ddf721d75dd45644001da830bd5e884c0b7856e'
AND (
token = 'RuqXPsJvLcP1HlYOFk2Mx8XTh5dcPCjUg5Gkv6ruX2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)