UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bFKn86XadKEcX1PQiwdwnDaX6jNq6lU8prWWwyLJw7g='
WHERE
key_id = 'a7f4f6485af3d38876293862fc9ca7d61cdb6750aa3a7c31e59b3956950c339d'
AND (
token = 'bFKn86XadKEcX1PQiwdwnDaX6jNq6lU8prWWwyLJw7g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)