UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qAAXRsZhgv6buYiMaLCyFKEyvF1qmwMRyCIPd+RGUSs='
WHERE
key_id = '6de047532c4647ae7b5c2c87e8bd9dda86dc62811d2550a2f7d0dd49c16c1a5c'
AND (
token = 'qAAXRsZhgv6buYiMaLCyFKEyvF1qmwMRyCIPd+RGUSs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)