UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KzaUl8AcEN1fVhntchWVWLktBwFZ0h48S1v4YOFMVdk='
WHERE
key_id = '5871b528a7dae069625c385346465c64a0145e22a0d3c73a22ffe31d1b4e244a'
AND (
token = 'KzaUl8AcEN1fVhntchWVWLktBwFZ0h48S1v4YOFMVdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)