UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd/Vp0Pu2iA3/9eq0j+QJ/GQ/gocIeUjAKTO2UEeJud4='
WHERE
key_id = 'a7b2e2f0acf99901198cc16430b772d9e5064776305c5cd589e1f33f649438c9'
AND (
token = 'd/Vp0Pu2iA3/9eq0j+QJ/GQ/gocIeUjAKTO2UEeJud4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)