UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bgYDNnq4+WUgyycW92BYWuLMtQlfNPBQs+kqcfDMC2Y='
WHERE
key_id = 'dfc6393eb861f5ef3c6a7979cf3e5e011096e3959cebd454434d0310d631c1eb'
AND (
token = 'bgYDNnq4+WUgyycW92BYWuLMtQlfNPBQs+kqcfDMC2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)