UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D2T7TBMIQ+zaU+h7CplnJx5sSaYcG1g1eE4akqNNLOU='
WHERE
key_id = 'd9ed5a3bf77c26daa9b011fe597cbf95f7f888b09be7f539e6e51f7f11061d7d'
AND (
token = 'D2T7TBMIQ+zaU+h7CplnJx5sSaYcG1g1eE4akqNNLOU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)