UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ic1S1pm6eNP4bj0kIADyx2gu3N/SmhWnQ/5dD4x+g9c='
WHERE
key_id = 'c5b923126afaeb88f5eebd8fea3e0bea9668767b70aff46645d2af8a9685123e'
AND (
token = 'ic1S1pm6eNP4bj0kIADyx2gu3N/SmhWnQ/5dD4x+g9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)