UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f//AMocaoFdgTbKXK9a5orExfo3IkuCJHDCCyR+kFjI='
WHERE
key_id = 'c4f16e4b40be108938ef189553f7fe53f81119885b30f3686c8f19d29c70859d'
AND (
token = 'f//AMocaoFdgTbKXK9a5orExfo3IkuCJHDCCyR+kFjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)