UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xCDN1uNJljQjNYcKIg66GKFi7+igSkGt552KApnzuHE='
WHERE
key_id = 'ffd4928821066e43dea601d2a244a2350e1e2f9a328fe8e6736da32934a68b70'
AND (
token = 'xCDN1uNJljQjNYcKIg66GKFi7+igSkGt552KApnzuHE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)