UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o5Pl+Z5isKyCzzbSsO68XglXk1r71KCwsTOUd7ip/+Q='
WHERE
key_id = 'c9049b6de14be07e0526dc3f7f2f4facb53b4153afde2f3bafef5fa8a3a5a1fe'
AND (
token = 'o5Pl+Z5isKyCzzbSsO68XglXk1r71KCwsTOUd7ip/+Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)