UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KBXCEF6umEdOK8C2TihgOtXJaREHH86MaG7lkQj6yw8='
WHERE
key_id = 'e8acefb1cce79d12c5145c1dc183c9b334849ef94d208e8ee739ca105ef7a1f9'
AND (
token = 'KBXCEF6umEdOK8C2TihgOtXJaREHH86MaG7lkQj6yw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)