UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lgNsyYUHdsk+RSw84LRksI2l1sQspjGXJ2KilLtq4W4='
WHERE
key_id = '20fe46b9d75ac506fd96339767b805aef4288ebada424a4ce3ea9f70e3b55770'
AND (
token = 'lgNsyYUHdsk+RSw84LRksI2l1sQspjGXJ2KilLtq4W4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)