UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f6iaVm7stVwPrNWVemnLkAtcdVSMpL/T9KVYU7vjND8='
WHERE
key_id = 'a80a2cd192a22c4fa7cd21ca346ffd6a1e7f807c1b031adf8c967f3450932bba'
AND (
token = 'f6iaVm7stVwPrNWVemnLkAtcdVSMpL/T9KVYU7vjND8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)