UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QpKDTI8L5HbY2JpGtWB8+vnFXbGq+D6H20OqeAZB6x0='
WHERE
key_id = '65f035c7d2bde98124bace3db42da145fe4568bb4d13a021575b98df83dc49d2'
AND (
token = 'QpKDTI8L5HbY2JpGtWB8+vnFXbGq+D6H20OqeAZB6x0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)