UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cMgBDQTVWAnjrJ9/qDEoDY9P/u+ALSI1MuUTetVS60o='
WHERE
key_id = '3ce936554d5f860b689c428aac7b501c88b4ebe14f01028588b8e7ee896a914c'
AND (
token = 'cMgBDQTVWAnjrJ9/qDEoDY9P/u+ALSI1MuUTetVS60o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)