UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TPkRcU1sC7jdlKNKOiKW9ghGoGTIyXbGKyia3OuXZU8='
WHERE
key_id = '3fae266176828a7843d01a48cf17836598fd365fde786f50355d2a83d688f6af'
AND (
token = 'TPkRcU1sC7jdlKNKOiKW9ghGoGTIyXbGKyia3OuXZU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)