UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uysoGlORjb68y3HSx0Rz8iH1J4y3HGCRdyOMD48camU='
WHERE
key_id = '6382a52625eaa29b1f0077e59d85957e43ac16493be137a15c6c3360e7566eab'
AND (
token = 'uysoGlORjb68y3HSx0Rz8iH1J4y3HGCRdyOMD48camU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)