UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mwHd3EWt7QZkTXhlnlmJVtFUS4fVSy9mHNE+8ORzyx4='
WHERE
key_id = '530945294fae02347d5a11aaf1d480aa3f4afdba7f5989c8579f0a96915a87a2'
AND (
token = 'mwHd3EWt7QZkTXhlnlmJVtFUS4fVSy9mHNE+8ORzyx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)