UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1IokkXQJ8lf0lNULJf5BYf9phkza+gJsG5l1DOW6Ni8='
WHERE
key_id = 'e9b65b778ca09fb06ed83f96c3ddcec56b1a86f670eeca792d52f78b8cdf12d3'
AND (
token = '1IokkXQJ8lf0lNULJf5BYf9phkza+gJsG5l1DOW6Ni8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)