UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd6qlpvQ77CYsCqOJV0veY28Z8ELq5tiSpGl+4KU3bKw='
WHERE
key_id = 'b9d7a4adc04374ecc6e4fbab0f1a9cfa9a6092e64087160c750746000d660dcb'
AND (
token = 'd6qlpvQ77CYsCqOJV0veY28Z8ELq5tiSpGl+4KU3bKw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)