UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3cLP+5+GXRh5zgYfTpuveUaKU9s26y9GXqYv1fvda3g='
WHERE
key_id = 'f536c52fa1f0b997145870578d3840ce151c813b8920f5c72140e05128ebc78c'
AND (
token = '3cLP+5+GXRh5zgYfTpuveUaKU9s26y9GXqYv1fvda3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)