UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xDAdgSG/ETmQkex0gCcXJg7pwOPzoj2GTvrwIUpZwkI='
WHERE
key_id = '9118b1fae6795dfabc224e3effe5e8c4f5686b84d555417f4ceb91fed988f21a'
AND (
token = 'xDAdgSG/ETmQkex0gCcXJg7pwOPzoj2GTvrwIUpZwkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)