UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ThDUaM83eNuYwRRHvrhtVJDe5mIQJJyb4nlYSB1m0XE='
WHERE
key_id = '87f96948a517c0879c743fe681cc70bbb202119aa70fedb197f0d5aa991d408f'
AND (
token = 'ThDUaM83eNuYwRRHvrhtVJDe5mIQJJyb4nlYSB1m0XE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)