UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6AVVlLEKr2xj6mLW8t4o+3wU7QT8YwHJKOUgZmUBe64='
WHERE
key_id = '1c8d71abdd59d3acb751d27d9711fd983114d21d4d3b7580806498c16200a097'
AND (
token = '6AVVlLEKr2xj6mLW8t4o+3wU7QT8YwHJKOUgZmUBe64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)