UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QpKQazQNYua4pA47Y0TWB1WCyOouAuMjmas3WjMekmc='
WHERE
key_id = 'a10561d69352816eb64a6c72c93ff1a1e424b6e09b59fc3428650a91aeed4742'
AND (
token = 'QpKQazQNYua4pA47Y0TWB1WCyOouAuMjmas3WjMekmc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)