UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kreJpaGUznM2kRoHJ3idZ7IGCfMTWL+Cx7rIV7coOes='
WHERE
key_id = 'e928da9a3ce573508bd29dd235bf7c595739bd33acceb1a77956c5a11d76e30c'
AND (
token = 'kreJpaGUznM2kRoHJ3idZ7IGCfMTWL+Cx7rIV7coOes='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)