UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yd44tW1Vg56t9PYAt9499xPSHlbJAgn+p+DdkPlO2U8='
WHERE
key_id = '5437574e5a8b346e6034d3818506c06b9f303bdeafa3a9e1e47d13ac3b514b44'
AND (
token = 'Yd44tW1Vg56t9PYAt9499xPSHlbJAgn+p+DdkPlO2U8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)