UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ik9oSR5GS10QZPiiBfQTjCzH+CqrvFdP+csx1a8hOxM='
WHERE
key_id = 'e844992e573362f2b851e89d3448661dbbac443442f85f3381777e5f1dc08c61'
AND (
token = 'ik9oSR5GS10QZPiiBfQTjCzH+CqrvFdP+csx1a8hOxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)