UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i5041iSkfCcxWbwKNetQFn6+s34OLUCOoB+nE2/xIBg=' 
WHERE 
  key_id = 'f852646e12af19065c64b71ea50b207fd0e60d9093b1793ce47dbb0b543ab6f8' 
  AND (
    token = 'i5041iSkfCcxWbwKNetQFn6+s34OLUCOoB+nE2/xIBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035