UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3XvyjnIsbO1j+ljlvwmEF7wnHgWd8+nAOSCh+Mmdm1k='
WHERE
key_id = '87f55484ec03bdd16a6e4efae8a8638f24951fa1e1cab81a408ea1604254af83'
AND (
token = '3XvyjnIsbO1j+ljlvwmEF7wnHgWd8+nAOSCh+Mmdm1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)